#!/usr/bin/python
# -*- coding: utf8 -*-

from math import sqrt

# 存储运算中需要用到的两个常量
a = (1+sqrt(5))/2.0
b = (1-sqrt(5))/2.0

def fib(n):
    """ Standard Formula """
    # 特殊情况：n为0或1
    if(n == 0):
        return 0
    elif(n == 1):
        return 1
    else:
        index = 2
        c = a
        d = b
        # 根据公式计算
        for index in range(2,n+1):
            c = c * a
            d = d * b
        return round((c-d)/sqrt(5))
